package com.oom;

/**
 * @description: 测试虚拟机栈溢出,
 *              线程请求的栈深度大于虚拟机所允许的深度
 * VM args: -Xss256k, JDK7+要求228k以上
 * @author: yuchi_huang (yuchi_huang@sui.com)
 * @date: 18/3/15
 * @modified By:
 */
public class JavaVMStackOverFlow {

    private int stackLength = 1;

    public void stackLeak(){
        stackLength++;
        stackLeak();
    }

    public static void main(String[] args) throws Exception{
        JavaVMStackOverFlow sof = new JavaVMStackOverFlow();

        try {
            sof.stackLeak();
        } catch (Exception e) {
            throw e;
        }finally {
            System.out.println("stack length:"+ sof.stackLength);
        }
    }

}
